package org.jimmy.tang.lang;

/**
 * @author jimmy
 * 
 */
public class PrimitiveDataTypes {

    public static void main(String[] args) {
        testDouble();
        testChar(new String[1]);
    }

    private static void testDouble(double dou) {
        if (Double.isNaN(dou)) {
            System.out.println("The varible is not a number!");
        } else if (Double.isInfinite(dou)) {
            System.out.println("The varible is infinite!");
        } else {
            System.out.println("Good!");
        }

    }

    private static void testDouble() {
        float f = 1.0F;// float必须有后缀，没有后缀的是double
        double d = 2.0;
        System.out.println(Float.SIZE);// 32
        System.out.println(Double.SIZE);// 64
        System.out.println(Float.MAX_VALUE);// 3.4028235E38
        System.out.println(Float.MIN_VALUE);// 1.4E-45
        System.out.println(Double.MAX_VALUE);// 1.7976931348623157E308
        System.out.println(Double.MIN_VALUE);// 4.9E-324

        testDouble(12.0 / 0);// The variable is infinite!
        testDouble(-12.0 / 0);// The variable is infinite!
        testDouble(0.0 / 0);// The variable is not a number!
        testDouble(Math.sqrt(-1));// The variable is not a number!
    }

    /**
     * char类型用来表示单个字符，通常用来表示字符常量
     * unicode编码的范围是\u0000~\uffff
     * 转义字符可以出现在字符常量或字符串的引号之内，
     * 不过也可以出现在字符常量或字符串的引号之外
     * @param args
     */
    private static void testChar(String\u005B\u005D args) {
        System.out.println("\u005B\u005D Hello\nWorld！");
    }

}
